//234
function isPalindrome(head) {
  const arr = [];
  let temp = head;
  while (temp != null) {
    arr.push(temp.val);
    temp = temp.next;
  }
  let i = 0,
    j = arr.length - 1;
  while (j >= i) {
    if (arr[i] !== arr[j]) {
      return false;
    }
    j--;
    i++;
  }
  return true;
}
